package com.demo.model.dto;

import java.util.List;

/**
 * @author shenguangyang
 */
public class EsPage<T> {
    // 在es中只表示当前搜索的页数量
    private long total;
    // 第几页
    private int pageNum;
    // 每页大小
    private int pageSize;
    // 是否为最后一页
    private boolean isLastPage = false;
    // 数据
    private List<T> list;

    public EsPage(long total, int pageNum, int pageSize, List<T> list) {


        this.total = total;
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = list;
        if (total <= pageSize) this.isLastPage = true;

        if (list.size() < pageSize) this.isLastPage = true      ;

    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }


    public boolean isLastPage() {
        return isLastPage;
    }

    public void setLastPage(boolean lastPage) {
        isLastPage = lastPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
